Potential reimplementation of gitstatus on c++11.#24
Potential reimplementation of gitstatus on c++11.#24starcraftman wants to merge 5 commits intomasterfrom
Conversation
- Haskell still slightly better at parallel usage but performance is essentially on par.
|
I would say go for it : ) As long as you have fun with a C++ implementation and people have another useful option they can use, why not. Rust is also an interesting language, but i guess the absolute ultimate conclusion performance wise would be to use plain C. |
|
Just for fun https://github.com/madnight/zsh-git-prompt/blob/fun/gitstatus.c On Arch Linux: But that does not help: Native C implementation required : ) |
|
Rust is somewhat known to me, that would introduce the extra dependency though of rust which not all programmers use/install/want (else we'd need to local bootstrap). It is very likely on the other hand that every programmer using zsh-git-prompt has a working C++ compiler, probably with C++11 support. I don't think Rust could go faster. I do find Rust interesting and I like how it enforces safety. That said, it can get a bit tiresome sometimes. As for C, perhaps. I'd unfortunately lose those nice C++ features. I don't think I can be bothered. Edit: On topic of making python go faster, pypy will make it go faster but not C fast. |
Yup, know what you mean, i've written serveral years in C++ (in combination with inline assembly). However, the many features of C++, that have been growing over the years, are also the language biggest deficit. It's a Monster now, where everything is possible in 500 different ways. I'm more a fan of an minimalistic approach and C or let's call it "portable assembly" fits the bill. I think that's why almost all linux /gnu reference implementation are written in C. Open Source in general: |
- Join becomes a function taking variable args with initializer list. - Includes now relative root. - Some other name cleanups and efficiencies.
- Add YCM config file. - Small changes to CMake. - Some code cleanup and a typo.
- Rename library files to be clear. - Fix header guards. - Preprend license to source files.
|
You can get surprisingly good speed out of the shell alone, not c++ fast, but this is about 2X faster than python (probably not at full parody), but has the added bonus of it already being formatted and removes the need for a subshell |
essentially on par.
I'm not fully decided if I want to do this yet, but I did make a C++ implementation for my own amusement. Won't consider merging until after large Haskell PR already in works. Comments are welcome.
It is mostly done, in that it supports all the features of gitstatus.py. This would unfortunately mean a third implementation. I can definitely maintain this one on my own though.
Performance wise, this implementation is essentially on par with Haskell on my i7. Took best trial of python vs two average runs.
Missing